package com.attendance.controller;

import com.attendance.common.CommonResult;
import com.attendance.pojo.GroupScore;
import com.attendance.pojo.Pages;
import com.attendance.service.GroupScoreService;
import com.attendance.vo.GroupScoreVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/groupScore")
public class GroupScoreController {

    @Autowired
    private GroupScoreService groupScoreService;

    /**
     * 分页处理的小组综合评分列表信息
     * @param pages
     * @return
     */
    @GetMapping({})
    public CommonResult selectAll(Pages pages){
        return groupScoreService.selectAll(pages);
    }

    /**
     * 分页处理的根据输入框查询的小组综合评分列表信息
     * @param pages
     * @param groupScoreVo
     * @return
     */
    @GetMapping("/selectByName")
    public CommonResult selectByName(Pages pages,GroupScoreVo groupScoreVo){
       return groupScoreService.selectByName(groupScoreVo,pages);
    }

    /**
     * 根据小组综合评分id查询小组综合评分详情页
     * @param gsId
     * @return
     */
    @GetMapping("{gsId}")
    public CommonResult selectById(@PathVariable("gsId") int gsId){
       return groupScoreService.selectById(gsId);
    }

    /**
     * 新增小组综合评分信息
     * @param groupScore
     * @return
     */
    @PostMapping("/addPersonalScore")
    public CommonResult addGroupScore(@RequestBody GroupScore groupScore){
        return groupScoreService.addGroupScore(groupScore);
    }

    /**
     * 修改小组综合评分信息
     * @param groupScore
     * @return
     */
    @PutMapping
    public CommonResult updateGroupScore(@RequestBody GroupScore groupScore){
        return groupScoreService.updateGroupScore(groupScore);
    }

    /**
     * 逻辑删除小组综合评分1
     * @param psId
     * @return
     */
    @PutMapping("{psId}")
    public CommonResult modifyGroupScore(@PathVariable String psId){
        return groupScoreService.modifyGroupScore(psId);
    }

}
